package org.qiyu.live.user.provider;


import jakarta.annotation.Resource;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.qiyu.live.user.provider.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * @Program qiyu-live-user-provider
 * @Description 用户中台服务提供者
 * @Author zx
 * @Create 2024-07-01 10:53
 **/
@SpringBootApplication
@EnableDiscoveryClient
@EnableDubbo
public class UserProviderApplication implements CommandLineRunner {

    private final Logger LOGGER = LoggerFactory.getLogger(UserProviderApplication.class);

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(UserProviderApplication.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.run(args);
//        SpringApplication.run(UserProviderApplication.class, args);
    }

    @Value("${nacos.password}")
    private String nacosPassword;
    @Resource
    private IUserService userService;

    @Override
    public void run(String... args) throws Exception {
//        System.out.println("nacos配置（qiyu-live-user-provider.yaml）中的domain: " + domain);
//        LOGGER.info("UserProviderApplication run() user: {}", userService.getByUserId(133002L));
        LOGGER.info("UserProviderApplication run() nacosPassword: {}", nacosPassword);
    }
}
